<template>
  <el-dialog v-model="dialog.showDialog" :append-to-body="false" :close-on-click-modal="false" :destroy-on-close="false"
             :loading="dialog.loading" :title="dialog.title"
             class="avue-dialog" draggable width="1400">
    <basic-crud ref="crudRef" :apiListParams="listPatrams" apiGetListMethod="post" :defaultListParams="{}"
                :fastSearch="{fastColumn:'modelName,pdmProductCode',name:'产品型号,产品编号'}"
                apiGetListUrl="mes/mesStatisticsController/listHrRecord" :option="option"></basic-crud>
  </el-dialog>
</template>

<script setup>
import { formatDate } from "@/utils/formatTime";
import {defineExpose} from 'vue';

const dialog = ref({
  showDialog: false,
  title: "人员统计明细",
  loading: false,
});

const option = ref({
  excelBtn: true,
  searchShow: false,
  calcHeight: 100,
  menu: false,
  addBtn:false,
  indexLabel: "序号",
  column: [
    {
      label: '项目号',
      prop: 'projectNum',
      width: 130,
    },
    {
      label: "产品型号",
      prop: "modelName",
      width: 150,
      search: true,
    },
    {
      label: "产品名称",
      prop: "pdmProductName",
      search: true,
    },
    {
      label: "产品编号",
      prop: "pdmProductCode",
      width: 150,
      search: true,
    },
    {
      label: "规程编号",
      prop: "specificationCode",
    },
    {
      label: "规程名称",
      prop: "specificationName",
    },
    {
      label: "工步号",
      prop: "processTaskCode",
      width: 60,
    },
    {
      label: "工步名称",
      prop: "processTaskName",
      width: 80,
    },
    {
      label: '完工日期',
      prop: 'finishCheckDateTime',
      width: 100,
      type: 'date',
      format: 'yyyy-MM-dd',
      formatter: (row) => {
        return formatDate(row.finishCheckDateTime, "yyyy-MM-dd");
      },
    }
  ]
});
const listPatrams = ref({});
const crudRef = ref(null);
const openDialog = (type, row) => {
  if (type === 'finish') {
    dialog.value.title = '人员统计明细【完工】';
  } else {
    dialog.value.title = '人员统计明细【计划】';
  }
  dialog.value.showDialog = true;
  listPatrams.value.userId = row.userId;

};

defineExpose({
  openDialog
});


</script>

<style lang="scss" scoped>

</style>
